package com.akaovi.chatroom.scene;

import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import org.kordamp.ikonli.javafx.FontIcon;

/**
 * @author akaovi
 * @version 1.0
 * @description 程序水印
 * @date 2022/12/9 17:31
 * @since 2022/12/9 17:31
 */
public class InfoBoard {
    static public VBox infoList = new VBox();
    static private Label text = new Label("Java期末大作业");
    static private FontIcon smile = new FontIcon("anto-smile");
    static private HBox hBox = new HBox();
    static public ImageView icon1 = new ImageView("gitee.png");
    static public FontIcon icon2 = new FontIcon("anto-github");
    static public ImageView icon3 = new ImageView("title-icon.png");
    static private Label akaovi = new Label("akaovi");

    static {
        text.setFont(new Font(18));
        text.setStyle("-fx-font-weight: bolder");
        icon1.setPreserveRatio(true);
        icon1.setFitHeight(65);
        icon1.setFitWidth(45);
        smile.setIconSize(40);
        icon2.setIconSize(45);
        icon3.setPreserveRatio(true);
        icon3.setFitHeight(65);
        icon3.setFitWidth(45);
        hBox.getChildren().addAll(icon1, icon2, icon3);
        hBox.setSpacing(10);
        hBox.setAlignment(Pos.CENTER);
        akaovi.setFont(new Font(14));
        infoList.getChildren().addAll(text, smile, hBox, akaovi);
        infoList.setAlignment(Pos.CENTER);
        infoList.setSpacing(20);
        infoList.setVisible(false);
        MainScene.gridPane.add(infoList, 3, 2, 4, 6);
    }

    /**
     * 展示
     */
    public static void showInfoBoard() {
        if (!infoList.isVisible()) {
            infoList.setVisible(true);
        }
    }

    /**
     * 不展示
     */
    public static void coverInfoBoard() {
        if (infoList.isVisible()) {
            infoList.setVisible(false);
        }
    }
}
